<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserOrderInfoBusinTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_order_info_busin', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户ID');
            $table->string('user_mobile',255)->comment('用户手机号');
            $table->integer('shop_id')->comment('商家id');
            $table->string('order_number',255)->comment('订单号');
            $table->decimal('order_amount',16,2)->comment('订单金额');
            $table->decimal('shop_amount',16,2)->comment('商家实收金额');
            $table->decimal('actual_amount',16,2)->comment('实付金额');
            $table->decimal('red_envelope_amount',16,2)->default(0.00)->comment('红包金额');
            $table->integer('red_envelope_id')->comment('红包id');
            $table->integer('comment_status',4)->default(0)->comment('评论状态');
            $table->integer('status',4)->default(0)->comment('是否结算');
            $table->integer('shop_user_id')->default(0)->comment('商家收款人ID');
            $table->tinyInteger('account_status',4)->default(0)->comment('是否结款');
            $table->dateTime('account_time')->comment('结款时间');
            $table->decimal('account_amount',16,2)->default(0.00)->comment('结款金额');
            $table->integer('refund_status',4)->defaulta(0)->comment('退款状态');
            $table->decimal('start_balance',16,2)->comment('交易前余额');
            $table->decimal('last_balance',16,2)->comment('交易后余额');
            $table->integer('city_id')->default(1)->comment('城市id');
            $table->integer('maintainer_id')->default(0)->comment('维护人id');
            $table->string('double_flower_status',4)->default(0)->comment('翻贝花状态(1.全天翻贝花，2.限时翻贝花，3.1/2翻贝花，4.1/3翻贝花)');
            $table->string('info',255)->comment('预留字段');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_order_info_busin');
    }
}
